<style scoped>
.login{
    padding-top: 30px;
}
label{
    width: 90%;
    margin: 30px auto;
    display: block;
    border-bottom: 1px solid #999;
}
input{
    width:100%;
    border:0;
    line-height: 30px;
    font-size: 14px;
    outline: none;
}
input::-webkit-input-placeholder { 
  color: #999;
  font-size: 14px;
}
button{
    outline: none;
    width:90%;
    margin:30px auto;
    line-height: 35px;
    color: #fff;
    background: #4C8DEB;
    border:0;
    border-radius: 3px;
    display: block;
}
button:last-child{
    background: #fff;
    color: #4C8DEB;
    border:1px solid #4C8DEB;
}
</style>
<template>
    <div class="login">
        <label>
            <input type="text" v-model="fm.tel" placeholder="+86  请输入手机号码">
        </label>
        <label>
            <input type="password" v-model="fm.pwd" placeholder="请输入密码">
        </label>
        <button @click="submit">登陆</button>
        <router-link to="register"><button>注册账号</button></router-link>
    </div>
</template>
<script>
import {activity_login} from "@/assets/api"
export default {
    data(){
        return {
            fm:{
                tel:'',
                pwd:''
            }
        }
    },
    methods:{
        submit(){
            activity_login(this.fm).then(res=>{
                if(res){
                    localStorage.setItem('unique_code',res.data.info.unique_code)
                    localStorage.setItem('name',res.data.info.name)
                    localStorage.setItem('client_id',res.data.info.id)
                    this.$router.push('home')
                }
            })
        }
    }
}
</script>

